home *** CD-ROM | disk | FTP | other *** search
/ 202 Game Collection / 202 Game Collection.iso / Ultimate / games / Braid.dxr / 00056.ls < prev    next >
Encoding:
Text File  |  2001-10-16  |  5.4 KB  |  208 lines

  1. global currentcard, founstart, orig, fromdis, discard, deck, enditat, iwin
  2.  
  3. on mouseUp me
  4.   if currentcard > 0 then
  5.     if sprite(currentcard).visible then
  6.       if (the mouseH > 345) and (the mouseV > 80) and (the mouseV < 245) then
  7.         checkaces()
  8.       else
  9.         if fromdis then
  10.           append(discard, sprite(currentcard).memberNum)
  11.           sprite(51).memberNum = discard[count(discard)]
  12.           sprite(51).visible = 1
  13.         else
  14.           sprite(orig).visible = 1
  15.         end if
  16.       end if
  17.       sprite(currentcard).visible = 0
  18.       puppetSound("dropcard")
  19.       currentcard = 0
  20.       fromdis = 0
  21.       orig = 0
  22.       fillSpots()
  23.       c = 0
  24.       repeat with blah = 41 to 48
  25.         if (sprite(blah).memberNum <> 53) and ((sprite(blah).memberNum mod 13) = enditat) then
  26.           c = c + 1
  27.         end if
  28.       end repeat
  29.       if c = 8 then
  30.         updateStage()
  31.         iwin = 1
  32.         go("over")
  33.       else
  34.         checkgameover()
  35.       end if
  36.     end if
  37.   end if
  38. end
  39.  
  40. on fillSpots
  41.   repeat with blah = 28 to 31
  42.     if sprite(blah).visible = 0 then
  43.       if count(deck) > 0 then
  44.         sprite(blah).memberNum = deck[1]
  45.         sprite(blah).visible = 1
  46.         deleteAt(deck, 1)
  47.         if count(deck) = 0 then
  48.         end if
  49.         next repeat
  50.       end if
  51.       if count(discard) > 0 then
  52.         sprite(blah).memberNum = discard[1]
  53.         sprite(blah).visible = 1
  54.         deleteAt(discard, 1)
  55.         if count(discard) = 0 then
  56.           sprite(51).visible = 0
  57.           sprite(51).memberNum = 53
  58.         end if
  59.       end if
  60.     end if
  61.   end repeat
  62.   repeat with blah = 34 to 37
  63.     if sprite(blah).visible = 0 then
  64.       if count(deck) > 0 then
  65.         sprite(blah).memberNum = deck[1]
  66.         sprite(blah).visible = 1
  67.         deleteAt(deck, 1)
  68.         if count(deck) = 0 then
  69.         end if
  70.         next repeat
  71.       end if
  72.       if count(discard) > 0 then
  73.         sprite(blah).memberNum = discard[1]
  74.         sprite(blah).visible = 1
  75.         deleteAt(discard, 1)
  76.         if count(discard) = 0 then
  77.           sprite(51).visible = 0
  78.           sprite(51).memberNum = 53
  79.         end if
  80.       end if
  81.     end if
  82.   end repeat
  83.   if sprite(27).visible = 0 then
  84.     blackletterday(27)
  85.   else
  86.     if sprite(32).visible = 0 then
  87.       blackletterday(32)
  88.     else
  89.       if sprite(33).visible = 0 then
  90.         blackletterday(33)
  91.       else
  92.         if sprite(38).visible = 0 then
  93.           blackletterday(38)
  94.         end if
  95.       end if
  96.     end if
  97.   end if
  98. end
  99.  
  100. on blackletterday who
  101.   mynum = 0
  102.   repeat with blah = 7 to 26
  103.     if (sprite(blah + 1).visible = 0) and (sprite(blah).visible = 1) then
  104.       mynum = blah
  105.     end if
  106.   end repeat
  107.   if mynum = 0 then
  108.     mynum = 26
  109.   end if
  110.   if sprite(mynum).visible then
  111.     sprite(who).memberNum = sprite(mynum).memberNum - 78
  112.     sprite(who).visible = 1
  113.     sprite(mynum).visible = 0
  114.   else
  115.     if count(discard) > 0 then
  116.       sprite(who).memberNum = discard[count(discard)]
  117.       sprite(who).visible = 1
  118.       deleteAt(discard, count(discard))
  119.       if count(discard) > 0 then
  120.         sprite(51).memberNum = discard[count(discard)]
  121.       else
  122.         sprite(51).visible = 0
  123.         sprite(51).memberNum = 53
  124.       end if
  125.     else
  126.       if count(deck) > 0 then
  127.         sprite(who).memberNum = deck[1]
  128.         sprite(who).visible = 1
  129.         deleteAt(deck, 1)
  130.       end if
  131.     end if
  132.   end if
  133. end
  134.  
  135. on checkaces
  136.   if (the mouseV > 80) and (the mouseV < 161) then
  137.     if (the mouseH > 345) and (the mouseH < 407) then
  138.       doitaces(41)
  139.     else
  140.       if (the mouseH > 406) and (the mouseH < 465) then
  141.         doitaces(42)
  142.       else
  143.         if (the mouseH > 464) and (the mouseH < 523) then
  144.           doitaces(43)
  145.         else
  146.           if (the mouseH > 522) and (the mouseH < 581) then
  147.             doitaces(44)
  148.           end if
  149.         end if
  150.       end if
  151.     end if
  152.   else
  153.     if (the mouseV > 160) and (the mouseV < 250) then
  154.       if (the mouseH > 345) and (the mouseH < 407) then
  155.         doitaces(45)
  156.       else
  157.         if (the mouseH > 406) and (the mouseH < 465) then
  158.           doitaces(46)
  159.         else
  160.           if (the mouseH > 464) and (the mouseH < 523) then
  161.             doitaces(47)
  162.           else
  163.             if (the mouseH > 522) and (the mouseH < 581) then
  164.               doitaces(48)
  165.             end if
  166.           end if
  167.         end if
  168.       end if
  169.     end if
  170.   end if
  171. end
  172.  
  173. on doitaces who
  174.   if sprite(who).memberNum = 53 then
  175.     if (sprite(currentcard).memberNum mod 13) = founstart then
  176.       sprite(who).memberNum = sprite(currentcard).memberNum
  177.       sprite(who).visible = 1
  178.     else
  179.       if fromdis then
  180.         append(discard, sprite(currentcard).memberNum)
  181.         sprite(51).memberNum = discard[count(discard)]
  182.         sprite(51).visible = 1
  183.       else
  184.         sprite(orig).visible = 1
  185.       end if
  186.     end if
  187.   else
  188.     if (sprite(currentcard).memberNum mod 13) <> founstart then
  189.       if ((sprite(currentcard).memberNum - 1) = sprite(who).memberNum) or (((sprite(currentcard).memberNum mod 13) = 1) and ((sprite(who).memberNum - 12) = sprite(currentcard).memberNum)) then
  190.         sprite(who).memberNum = sprite(currentcard).memberNum
  191.         sprite(who).visible = 1
  192.       else
  193.         if fromdis then
  194.           append(discard, sprite(currentcard).memberNum)
  195.           sprite(51).memberNum = discard[count(discard)]
  196.           sprite(51).visible = 1
  197.         else
  198.           sprite(orig).visible = 1
  199.         end if
  200.       end if
  201.     end if
  202.   end if
  203. end
  204.  
  205. on exitFrame me
  206.   go(the frame)
  207. end
  208.